package com.qh.book.converter;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.BeanUtils;

import com.qh.book.dataobj.OrderDetail;
import com.qh.book.dto.CartDTO;

public class OrderDetail2CartDTO {

	public static CartDTO converter(OrderDetail orderDetail) {
		CartDTO dto = new CartDTO();
		BeanUtils.copyProperties(orderDetail, dto);
		return dto;
	}
	
	public static List<CartDTO> converter(List<OrderDetail> orderDetailList) {
		List<CartDTO> cartDTOList = new ArrayList<CartDTO>();
		for (OrderDetail OrderDetail : orderDetailList) {
			CartDTO dto = new CartDTO();
			dto = converter(OrderDetail);
			cartDTOList.add(dto);
		}
	
		return cartDTOList;
	}
}
